#include <iostream>
#include <string>
using namespace std;



int main(){
	string a;
	int b = 1,c = 0,d,e = 0;
	cin>>a;
	

	for(int i = a.length()-1;i >= 0;i--){
		if(a[i]=='.'){
			e = 1;
			b = 1;
			if(a[i+1]-'0' >= 5){
	    		c = 1;
	    	}
		}
		else{
  			d = a[i]-'0'+c;
			b = b*d%10007;
			c = 0;
		}
		
		if(d == 10   ||   (d == 0   &&   e == 1)){
			b = 0;
			break;
		}
		//cout<<a[i]-'0'<<endl;
	}
	cout<<b;
	return 0;
} 
